/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.gft.bancosimulador.controller;

import com.gft.bancosimulador.beans.Cliente;
import com.gft.bancosimulador.business.ClienteBusiness;
import com.gft.bancosimulador.outros.Sucesso;
import com.gft.bancosimulador.exceptions.RegradeNegocioException;
import com.gft.bancosimulador.exceptions.ValidadorSituacao;
import com.gft.bancosimulador.views.ClienteView;
import javax.swing.JOptionPane;

/**
 *
 * @author AEPI
 */
public class ReativarClienteController extends ClienteView {

    private Cliente clienteTeste;
    public ReativarClienteController() {
        
    }
    public ReativarClienteController(int codigo){
        this.consultar(codigo);
    }

    @Override
    public void salvar() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void cancelar(){
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    protected String getTitulo() {
        return "Reativar Cliente";
    }

    @Override
    protected String getRotuloIdentificador() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    protected String getFormatoMascaraIdentificador() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void reativar() {
        try{
        
        ValidadorSituacao.validarDesbloqueio(txt_EstadoCliente.getText());
        Sucesso s = ClienteBusiness.getInstance().reativarCliente(clienteTeste.getCodigo());
        this.mostrarStatus(s);
        }catch(RegradeNegocioException ex){
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }
    
    @Override
    public void exibirCliente(Cliente c) {
        super.exibirCliente(c);
        clienteTeste = c;
    }

    @Override
    public void bloquear() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
